﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_teachermanage : AdminPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {
            BindDept();
            BindTeacher();
            
        }
    }
    /// <summary>
    /// 绑定
    /// </summary>
    private void BindTeacher() {
        List<Exam.Core.Model.Master> list = new Exam.Core.DAL.Master().getMasterAllList();
        rp.DataSource = list;
        rp.DataBind();
        LibStuCount.Text = list.Count.ToString();
    }

    private void BindDept() {
        List<Exam.Core.Model.Department> Departlist = new Exam.Core.DAL.Department().getDepartmentAllList();
        foreach (Exam.Core.Model.Department obj in Departlist) {
            departddl.Items.Add(new ListItem(obj.DepartmentName.Trim(), obj.DepartmentID.Trim()));
            departddl2.Items.Add(new ListItem(obj.DepartmentName.Trim(), obj.DepartmentID.Trim()));
        }
        //departddl.Items.Insert(0, new ListItem("选择单位", "0"));
        //departddl2.Items.Insert(0, new ListItem("选择单位", "0"));
    }

    protected string getDepart(string id) {
        string result = "";
        int b = 0;
        string[] list = id.Trim(',').Split(',');
        foreach (ListItem item in departddl.Items) {
            for (int i = 0; i < list.Length; i++)
            {
                if (list[i].Trim() == item.Value.Trim())
                {
                    result += item.Text.Trim()+"，";

                }
            }
        }
        return result.Trim('，');
    }

}